package com.test.exception_catch.diy_exception;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
public class DiyExceptionHandler {

    @ExceptionHandler(DiyException.class)
    public @ResponseBody String handleException(DiyException e) {
        return "自定义异常捕获：" + e.getErrorMsg();
    }
}